package com.t235.gc.user.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.t235.gc.AjaxResult;
import com.t235.gc.entity.Users;
import com.t235.gc.user.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api
@RestController
@RequestMapping("/user")
public class UsersController {

    @Autowired
    private UserService userService;

    @PostMapping("/userList")
    public AjaxResult getUsersList(Users users,@RequestParam(value="page")Integer page,@RequestParam(value="limit") Integer pageSize){
        PageHelper.startPage(page,pageSize);
        List<Users> list = userService.selectUsers(users);
        PageInfo<Users> pageInfo = new PageInfo<>(list);
        return AjaxResult.success(pageInfo);
    }


}


